<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <script>
        // 原型链的访问顺序，先访问自己的，没有往上找


        // Grand.prototype.__proto__ = Object.prototype
        // Object.prototype为原型链的最终端
        Grand.prototype.lastName = "Deng";
        function Grand() {

        }
        var grand = new Grand();


        Father.prototype = grand;
        function Father() {
            this.name = 'xuming';
            this.card = {
                card1: '123'
            };
            this.num = 100; 
        }
        var father = new Father();


        Son.prototype = father;
        function Son() {
            this.hobbit = 'smoke';
        }
        var son = new Son();

        // 可以这样修改father的内容
        son.card.card2 = '234';

        son.num = son.num + 1;//或者son.num ++
        // 为自身添加属性
    </script> -->

    <!-- <script>

        Person.prototype = {
            name: 'a',
            sayName: function() {
                console.log(this.name);
            }
        }

        function Person () {
            this.name = 'b';
        }

        var person = new Person(); 
        person.sayName();
        Person.prototype.sayName();

        // sayName里面的this指向是，谁调用的这个方法，this就指向谁
    </script> -->

    <script>

        Person.prototype = {
            height: 100
        }

        function Person() {
            this.eat = function() {
                this.height ++;
            }
        }

        var person = new Person();

        person.eat();
    </script>
</body>
</html>